package zhai.git.test;

/**
 * @author Created by 翟凤玺
 * @package zhai.git.test
 * @project-name 项目名称
 * @description //TODO 请对该类编写一个描述
 * @create-datetime 2021/4/26 13:41
 */
public class C {

    //2. 静态内部类
    static class GG2 implements I {
        @Override
        public void happy(String h) {
            System.out.println("happy" + h);
        }
    }

    public static void main(String[] args) {
        I i = new GG();
        i.happy("１");
        I i2 = new GG2();
        i2.happy("２");
        // 3. 局部内部类
        class GG3 implements I {
            @Override
            public void happy(String h) {
                System.out.println("happy" + h);
            }
        }
        I i3 = new GG3();
        i3.happy("３");
        // 4.　匿名内部类
        I i4 = new I() {
            @Override
            public void happy(String h) {
                System.out.println("happy" + h);
            }
        };
        i4.happy("４");
        // 5. lanbda
        I i5 = (h) -> {
            System.out.println("happy" + h);
        };
        i5.happy("５");
        // 6. runnable的lanbda实现
        Runnable runnable = ()-> {
            System.out.println(Thread.currentThread().getName());
        };
        for (int i1 = 0; i1 < 3; i1++) {
            new Thread(runnable).start();

        }
    }
}


// 接口
interface I {
    void happy(String h);
}

// 1.接口实现类
class GG implements I {
    @Override
    public void happy(String h) {
        System.out.println("happy" + h);
    }
}